package org.example.im.server.handler.impl;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import org.example.im.bean.protocol.request.HeartBeatRequestPacket;
import org.example.im.bean.protocol.response.HeartBeatResponsePacket;
import org.springframework.stereotype.Component;

/**
 * @author dingrui
 * @since 2022/2/12
 * @description
 */
@Component
public class HeartBeatHandler extends SimpleChannelInboundHandler<HeartBeatRequestPacket> {

    @Override
    protected void channelRead0(ChannelHandlerContext channelHandlerContext, HeartBeatRequestPacket heartBeatRequestPacket) throws Exception {
        channelHandlerContext.writeAndFlush(new HeartBeatResponsePacket());
    }
}
